package com.syl.entity;

import java.sql.Date;
import java.util.Objects;

/**
 * --- 就那样---
 *
 * @author SYL
 * @date 2025/7/24
 * @desc ////////////////
 * 上午8：50～10：20
 * 10：40～12：00
 * 下午13:50~15:10
 * 15:30~18:00
 * 晚自习19-21
 * //////////////////
 */

/**
 * 实体类
 * 实体类: 数据表中零散数据的载体,用来封装数据.
 * ● 表名 设计 类名
 * ● 将列名设计成属性名
 *   ○ id --> id
 *   ○ create_time --> createTime (下划线转驼峰)
 * ● 将列的数据类型设计成属性的数据类型
 * ● 给类提供对应set get
 * 一般项目中一个表就会对应一个实体类,所有的实体类都会放在model/entity/pojo/javabeen包结构中
 */
public class User {
  private int id;
  private String username;
  private String password;
  private String phone;
  private Date createTime;
  private double money;

  private int sex;

 @Override
 public String toString() {
  return "User{" +
          "id=" + id +
          ", username='" + username + '\'' +
          ", password='" + password + '\'' +
          ", phone='" + phone + '\'' +
          ", createTime=" + createTime +
          ", money=" + money +
          ", sex=" + sex +
          '}';
 }

 @Override
 public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  User user = (User) o;
  return id == user.id && Double.compare(money, user.money) == 0 && sex == user.sex && Objects.equals(username, user.username) && Objects.equals(password, user.password) && Objects.equals(phone, user.phone) && Objects.equals(createTime, user.createTime);
 }

 @Override
 public int hashCode() {
  return Objects.hash(id, username, password, phone, createTime, money, sex);
 }

 public int getId() {
  return id;
 }

 public void setId(int id) {
  this.id = id;
 }

 public String getUsername() {
  return username;
 }

 public void setUsername(String username) {
  this.username = username;
 }

 public String getPassword() {
  return password;
 }

 public void setPassword(String password) {
  this.password = password;
 }

 public String getPhone() {
  return phone;
 }

 public void setPhone(String phone) {
  this.phone = phone;
 }

 public String getCreateTime() {
  return createTime.toString();
 }

 public void setCreateTime(Date createTime) {
  this.createTime = createTime;
 }

 public double getMoney() {
  return money;
 }

 public void setMoney(double money) {
  this.money = money;
 }

 public int getSex() {
  return sex;
 }

 public void setSex(int sex) {
  this.sex = sex;
 }

 public User(int id, String username, String password, String phone, Date createTime, double money, int sex) {
  this.id = id;
  this.username = username;
  this.password = password;
  this.phone = phone;
  this.createTime = createTime;
  this.money = money;
  this.sex = sex;
 }

 public User(String username, String password, String phone, Date createTime, int sex) {
  this.username = username;
  this.password = password;
  this.phone = phone;
  this.createTime = createTime;
  this.sex = sex;
 }

 public User() {
 }
}
